<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="author" content="esy">
    
    <meta name="description" content="esy">
    
    
    
    
    
    
    <title>python-入门复习面向对象 | ESY</title>
    <link href="https://esyyes.github.io" rel="prefetch" />

    
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/aos.css">
<link rel="stylesheet" href="/css/style.css">

    
<script src="/js/jquery.min.js"></script>

    
<script src="/js/bootstrap.min.js"></script>

    
<script src="/js/aos.js"></script>

    
<script src="/js/highslide/highslide-full.min.js"></script>

    
<link rel="stylesheet" href="/js/highslide/highslide.css">

    <style type="text/css">
        @media (max-width: 768px) {
            body {
                background-color: #f0f0f0;
                background: url('/imgs/xsbg.gif');
                background-attachment: fixed;
            }
        }
    </style>
    
    <!--<script type="text/javascript">
      if (document.images) {
        var avatar = new Image();
        avatar.src = '/imgs/avatar.jpg'
        var previews = 'preview1.jpg,preview2.jpg,preview3.jpg,preview4.jpg'.split(',')
        var previewsPreLoad = []
        for(var i = 0; i < length; i++) {
          previewsPreLoad.push(new Image())
          previewsPreLoad[previewsPreLoad.length - 1].src = '/imgs/preview' + previews[i]
        }
      }
    </script>-->
<meta name="generator" content="Hexo 5.2.0"></head>
<body>
    <!-- 背景轮播图功能 -->
    <section class="hidden-xs">
    <ul class="cb-slideshow">
        <li><span>天若</span></li>
        <li><span>有情</span></li>
        <li><span>天亦老</span></li>
        <li><span>我为</span></li>
        <li><span>长者</span></li>
        <li><span>续一秒</span></li>
    </ul>
</section>
    <!-- 欧尼酱功能, 谁用谁知道 -->
    
    <div class="gal-menu gal-dropdown">
    <div class="circle" id="gal">
        <div class="ring">
            <a href="https://esyyes.github.io" class="menuItem" style="left: 50%; top: 15%;">首页</a>
            
            <a class="menuItem" style="left: 80.3109%; top: 32.5%;">下一页</a>
            
            <a href="/archives" class="menuItem" style="left: 80.3109%; top: 67.5%;">归档</a>
            <a href="/about" class="menuItem" style="left: 50%; top: 85%;">关于</a>
            <a href="/message" class="menuItem" style="left: 19.6891%; top: 67.5%;">留言板</a>

            
            <a class="menuItem" style="left: 19.6891%; top: 32.5%;">上一页</a>
            
        </div>
        <audio id="audio" src="/imgs/oni.mp3"></audio>
    </div>
</div>
    
    <header class="navbar navbar-inverse" id="gal-header">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed"
                    data-toggle="collapse" data-target=".bs-navbar-collapse"
                    aria-expanded="false">
                <span class="fa fa-lg fa-reorder"></span>
            </button>
            <a href="https://esyyes.github.io">
                
                <style>
                    #gal-header .navbar-brand {
                        height: 54px;
                        line-height: 24px;
                        font-size: 28px;
                        opacity: 1;
                        background-color: rgba(0,0,0,0);
                        text-shadow: 0 0 5px #fff,0 0 10px #fff,0 0 15px #fff,0 0 20px #228DFF,0 0 35px #228DFF,0 0 40px #228DFF,0 0 50px #228DFF,0 0 75px #228DFF;
                    }
                </style>
                <!-- 这里使用文字(navbar_text or config.title) -->
                <div class="navbar-brand">ESY</div>
                
            </a>
        </div>
        <div class="collapse navbar-collapse bs-navbar-collapse">
            <ul class="nav navbar-nav" id="menu-gal">
                
                
                <li class="">
                    <a href="/">
                        <i class="fa fa-home"></i>首页
                    </a>
                </li>
                
                
                
                <li class="">
                    <a href="/archives">
                        <i class="fa fa-archive"></i>归档
                    </a>
                </li>
                
                
                
                
                <li class="dropdown">
                    <!-- TODO 添加hover dropdown效果 -->
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                       aria-haspopup="true" aria-expanded="false" data-hover="dropdown">
                        <i class="fa fa-list"></i>分类
                    </a>
                    <ul class="dropdown-menu">
                        
                        
                        <li>
                            <a href="/categories/py-study/">py_study</a>
                        </li>
                        
                        <li>
                            <a href="/categories/nlp/">nlp</a>
                        </li>
                        
                        <li>
                            <a href="/categories/Graduation-work/">Graduation work</a>
                        </li>
                        
                        <li>
                            <a href="/categories/work/">work</a>
                        </li>
                        
                        <li>
                            <a href="/categories/hexo/">hexo</a>
                        </li>
                        
                        <li>
                            <a href="/categories/hexo%E5%AE%8C%E5%96%84/">-hexo完善</a>
                        </li>
                        
                        
                        <li>
                            <a href="/categories">...</a>
                        </li>
                        
                        
                    </ul>
                </li>
                
                
                
                
                
                <li class="dropdown">
                    <!-- TODO 添加hover dropdown效果 -->
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                       aria-haspopup="true" aria-expanded="false" data-hover="dropdown">
                        <i class="fa fa-tags"></i>标签
                    </a>
                    <ul class="dropdown-menu">
                        
                        
                        <li>
                            <a href="/tags/py-study/">py_study</a>
                        </li>
                        
                        <li>
                            <a href="/tags/nlp/">nlp</a>
                        </li>
                        
                        <li>
                            <a href="/tags/Graduation-work/">Graduation work</a>
                        </li>
                        
                        <li>
                            <a href="/tags/work/">work</a>
                        </li>
                        
                        <li>
                            <a href="/tags/hexo/">hexo</a>
                        </li>
                        
                        <li>
                            <a href="/tags/%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">-个人博客搭建</a>
                        </li>
                        
                        
                        <li>
                            <a href="/tags">...</a>
                        </li>
                        
                        
                    </ul>
                </li>
                
                
                
                
                <li class="">
                    <a href="/about">
                        <i class="fa fa-user"></i>关于我
                    </a>
                </li>
                
                
            </ul>
        </div>
    </div>
</header>
    <div id="gal-body">
        <div class="container">
            <div class="row">
                <div class="col-md-8 gal-right" id="mainstay">
                    
<article class="article well article-body" id="article">
    <div class="breadcrumb">
        <i class="fa fa-home"></i>
        <a href="https://esyyes.github.io">ESY</a>
        >
        <span>python-入门复习面向对象</span>
    </div>
    <!-- 大型设备详细文章 -->
    <div class="hidden-xs">
        <div class="title-article">
            <h1>
                <a href="/2020/05/26/python%20work/python-%E5%85%A5%E9%97%A8%E5%A4%8D%E4%B9%A0%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1/">python-入门复习面向对象</a>
            </h1>
        </div>
        <div class="tag-article">
            
            <span class="label label-gal">
                <i class="fa fa-tags"></i>
                
                <a href="/tags/python/">python</a>
                
            </span>
            
            <span class="label label-gal">
                <i class="fa fa-calendar"></i> 2020-05-26
            </span>
            
        </div>
    </div>
    <!-- 小型设备详细文章 -->
    <div class="visible-xs">
        <center>
            <div class="title-article">
                <h4>
                    <a href="/2020/05/26/python%20work/python-%E5%85%A5%E9%97%A8%E5%A4%8D%E4%B9%A0%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1/">python-入门复习面向对象</a>
                </h4>
            </div>
            <p>
                <i class="fa fa-calendar"></i> 2020-05-26
            </p>
            <p>
                
                <i class="fa fa-tags"></i>
                
                <a href="/tags/python/">python</a>
                
                
                
            </p>
        </center>
    </div>
    <div class="content-article">
        <h1 id="python-入门复习面向对象"><a href="#python-入门复习面向对象" class="headerlink" title="python-入门复习面向对象"></a>python-入门复习面向对象</h1><p>很类似于数据库slpdb</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br><span class="line">371</span><br><span class="line">372</span><br><span class="line">373</span><br><span class="line">374</span><br><span class="line">375</span><br><span class="line">376</span><br><span class="line">377</span><br><span class="line">378</span><br><span class="line">379</span><br><span class="line">380</span><br><span class="line">381</span><br><span class="line">382</span><br><span class="line">383</span><br><span class="line">384</span><br><span class="line">385</span><br><span class="line">386</span><br><span class="line">387</span><br><span class="line">388</span><br><span class="line">389</span><br><span class="line">390</span><br><span class="line">391</span><br><span class="line">392</span><br><span class="line">393</span><br><span class="line">394</span><br><span class="line">395</span><br><span class="line">396</span><br><span class="line">397</span><br><span class="line">398</span><br><span class="line">399</span><br><span class="line">400</span><br><span class="line">401</span><br><span class="line">402</span><br><span class="line">403</span><br><span class="line">404</span><br><span class="line">405</span><br><span class="line">406</span><br><span class="line">407</span><br><span class="line">408</span><br><span class="line">409</span><br><span class="line">410</span><br><span class="line">411</span><br><span class="line">412</span><br><span class="line">413</span><br><span class="line">414</span><br><span class="line">415</span><br><span class="line">416</span><br><span class="line">417</span><br><span class="line">418</span><br><span class="line">419</span><br><span class="line">420</span><br><span class="line">421</span><br><span class="line">422</span><br><span class="line">423</span><br><span class="line">424</span><br><span class="line">425</span><br><span class="line">426</span><br><span class="line">427</span><br><span class="line">428</span><br><span class="line">429</span><br><span class="line">430</span><br><span class="line">431</span><br><span class="line">432</span><br><span class="line">433</span><br><span class="line">434</span><br><span class="line">435</span><br><span class="line">436</span><br><span class="line">437</span><br><span class="line">438</span><br><span class="line">439</span><br><span class="line">440</span><br><span class="line">441</span><br><span class="line">442</span><br><span class="line">443</span><br><span class="line">444</span><br><span class="line">445</span><br><span class="line">446</span><br><span class="line">447</span><br><span class="line">448</span><br><span class="line">449</span><br><span class="line">450</span><br><span class="line">451</span><br><span class="line">452</span><br><span class="line">453</span><br><span class="line">454</span><br><span class="line">455</span><br><span class="line">456</span><br><span class="line">457</span><br><span class="line">458</span><br><span class="line">459</span><br><span class="line">460</span><br><span class="line">461</span><br><span class="line">462</span><br><span class="line">463</span><br><span class="line">464</span><br><span class="line">465</span><br><span class="line">466</span><br><span class="line">467</span><br><span class="line">468</span><br><span class="line">469</span><br><span class="line">470</span><br><span class="line">471</span><br><span class="line">472</span><br><span class="line">473</span><br><span class="line">474</span><br><span class="line">475</span><br><span class="line">476</span><br><span class="line">477</span><br><span class="line">478</span><br><span class="line">479</span><br><span class="line">480</span><br><span class="line">481</span><br><span class="line">482</span><br><span class="line">483</span><br><span class="line">484</span><br><span class="line">485</span><br><span class="line">486</span><br><span class="line">487</span><br><span class="line">488</span><br><span class="line">489</span><br><span class="line">490</span><br><span class="line">491</span><br><span class="line">492</span><br><span class="line">493</span><br><span class="line">494</span><br><span class="line">495</span><br><span class="line">496</span><br><span class="line">497</span><br><span class="line">498</span><br><span class="line">499</span><br><span class="line">500</span><br><span class="line">501</span><br><span class="line">502</span><br><span class="line">503</span><br><span class="line">504</span><br><span class="line">505</span><br><span class="line">506</span><br><span class="line">507</span><br><span class="line">508</span><br><span class="line">509</span><br><span class="line">510</span><br><span class="line">511</span><br><span class="line">512</span><br><span class="line">513</span><br><span class="line">514</span><br><span class="line">515</span><br><span class="line">516</span><br><span class="line">517</span><br><span class="line">518</span><br><span class="line">519</span><br><span class="line">520</span><br><span class="line">521</span><br><span class="line">522</span><br><span class="line">523</span><br><span class="line">524</span><br><span class="line">525</span><br><span class="line">526</span><br><span class="line">527</span><br><span class="line">528</span><br><span class="line">529</span><br><span class="line">530</span><br><span class="line">531</span><br><span class="line">532</span><br><span class="line">533</span><br><span class="line">534</span><br><span class="line">535</span><br><span class="line">536</span><br><span class="line">537</span><br><span class="line">538</span><br><span class="line">539</span><br><span class="line">540</span><br><span class="line">541</span><br><span class="line">542</span><br><span class="line">543</span><br><span class="line">544</span><br><span class="line">545</span><br><span class="line">546</span><br><span class="line">547</span><br><span class="line">548</span><br><span class="line">549</span><br><span class="line">550</span><br><span class="line">551</span><br><span class="line">552</span><br><span class="line">553</span><br><span class="line">554</span><br><span class="line">555</span><br><span class="line">556</span><br><span class="line">557</span><br><span class="line">558</span><br><span class="line">559</span><br><span class="line">560</span><br><span class="line">561</span><br><span class="line">562</span><br><span class="line">563</span><br><span class="line">564</span><br><span class="line">565</span><br><span class="line">566</span><br><span class="line">567</span><br><span class="line">568</span><br><span class="line">569</span><br><span class="line">570</span><br><span class="line">571</span><br><span class="line">572</span><br><span class="line">573</span><br><span class="line">574</span><br><span class="line">575</span><br><span class="line">576</span><br><span class="line">577</span><br><span class="line">578</span><br><span class="line">579</span><br><span class="line">580</span><br><span class="line">581</span><br><span class="line">582</span><br><span class="line">583</span><br><span class="line">584</span><br><span class="line">585</span><br><span class="line">586</span><br><span class="line">587</span><br><span class="line">588</span><br><span class="line">589</span><br><span class="line">590</span><br><span class="line">591</span><br><span class="line">592</span><br><span class="line">593</span><br><span class="line">594</span><br><span class="line">595</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># -*- coding: utf-8 -*-</span></span><br><span class="line"><span class="comment"># @Time     : 2020/5/26</span></span><br><span class="line"><span class="comment"># @Author   : esy</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">面向对象基础</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">==面向对象就是将编程当成是一个事物，对外界来说，事物是直接使用的，不用去管他内部的情况。而编程就是设置事物能够做什么事。==</span></span><br><span class="line"><span class="string">类和对象的关系：用类去创建一个对象。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">类是对一系列具有相同==特征==和==行为==的事物的统称，是一个==抽象的概念==，不是真实存在的事物。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 特征即是属性</span></span><br><span class="line"><span class="string">- 行为即是方法</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">对象是类创建出来的真实存在的事物</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"> 定义类</span></span><br><span class="line"><span class="string">Python2中类分为：经典类 和 新式类</span></span><br><span class="line"><span class="string">class 类名():</span></span><br><span class="line"><span class="string">    代码</span></span><br><span class="line"><span class="string">    ......</span></span><br><span class="line"><span class="string">注意：类名要满足标识符命名规则，同时遵循==大驼峰命名习惯==。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class Washer():</span></span><br><span class="line"><span class="string">    def wash(self):</span></span><br><span class="line"><span class="string">        print(&#x27;我会洗衣服&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">不由任意内置类型派生出的类，称之为经典类</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class 类名:</span></span><br><span class="line"><span class="string">    代码</span></span><br><span class="line"><span class="string">    ......</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">创建对象</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">对象又名实例。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 语法</span></span><br><span class="line"><span class="string">对象名 = 类名()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 创建对象</span></span><br><span class="line"><span class="string">haier1 = Washer()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># &lt;__main__.Washer object at 0x0000018B7B224240&gt;</span></span><br><span class="line"><span class="string">print(haier1)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># haier对象调用实例方法</span></span><br><span class="line"><span class="string">haier1.wash()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">self指的是调用该函数的对象。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 1. 定义类</span></span><br><span class="line"><span class="string">class Washer():</span></span><br><span class="line"><span class="string">    def wash(self):</span></span><br><span class="line"><span class="string">        print(&#x27;我会洗衣服&#x27;)</span></span><br><span class="line"><span class="string">        # &lt;__main__.Washer object at 0x0000024BA2B34240&gt;</span></span><br><span class="line"><span class="string">        print(self)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 2. 创建对象</span></span><br><span class="line"><span class="string">haier1 = Washer()</span></span><br><span class="line"><span class="string"># &lt;__main__.Washer object at 0x0000018B7B224240&gt;</span></span><br><span class="line"><span class="string">print(haier1)</span></span><br><span class="line"><span class="string"># haier1对象调用实例方法</span></span><br><span class="line"><span class="string">haier1.wash()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">haier2 = Washer()</span></span><br><span class="line"><span class="string"># &lt;__main__.Washer object at 0x0000022005857EF0&gt;</span></span><br><span class="line"><span class="string">print(haier2)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">打印对象和self得到的结果是一致的，都是当前对象的内存中存储地址。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">对象名.属性名 = 值</span></span><br><span class="line"><span class="string">对象名.属性名</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">print(f&#x27;haier1洗衣机的宽度是&#123;haier1.width&#125;&#x27;)</span></span><br><span class="line"><span class="string">print(f&#x27;haier1洗衣机的高度是&#123;haier1.height&#125;&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">self.属性名</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 定义类</span></span><br><span class="line"><span class="string">class Washer():</span></span><br><span class="line"><span class="string">    def print_info(self):</span></span><br><span class="line"><span class="string">        # 类里面获取实例属性</span></span><br><span class="line"><span class="string">        print(f&#x27;haier1洗衣机的宽度是&#123;self.width&#125;&#x27;)</span></span><br><span class="line"><span class="string">        print(f&#x27;haier1洗衣机的高度是&#123;self.height&#125;&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 创建对象</span></span><br><span class="line"><span class="string">haier1 = Washer()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 添加实例属性</span></span><br><span class="line"><span class="string">haier1.width = 500</span></span><br><span class="line"><span class="string">haier1.height = 800</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">haier1.print_info()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">在Python中，`__xx__()`的函数叫做魔法方法，指的是具有特殊功能的函数。</span></span><br><span class="line"><span class="string">==`__init__()`方法的作用：初始化对象。==</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class Washer():</span></span><br><span class="line"><span class="string">    </span></span><br><span class="line"><span class="string">    # 定义初始化功能的函数</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        # 添加实例属性</span></span><br><span class="line"><span class="string">        self.width = 500</span></span><br><span class="line"><span class="string">        self.height = 800</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def print_info(self):</span></span><br><span class="line"><span class="string">        # 类里面调用实例属性</span></span><br><span class="line"><span class="string">        print(f&#x27;洗衣机的宽度是&#123;self.width&#125;, 高度是&#123;self.height&#125;&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">haier1 = Washer()</span></span><br><span class="line"><span class="string">haier1.print_info()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">注意：</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- `__init__()`方法，在创建一个对象时默认被调用，不需要手动调用</span></span><br><span class="line"><span class="string">- `__init__(self)`中的self参数，不需要开发者传递，python解释器会自动把当前的对象引用传递过去。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">一个类可以创建多个对象，如何对不同的对象设置不同的初始化属性呢？</span></span><br><span class="line"><span class="string">class Washer():</span></span><br><span class="line"><span class="string">    def __init__(self, width, height):</span></span><br><span class="line"><span class="string">        self.width = width</span></span><br><span class="line"><span class="string">        self.height = height</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def print_info(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;洗衣机的宽度是&#123;self.width&#125;&#x27;)</span></span><br><span class="line"><span class="string">        print(f&#x27;洗衣机的高度是&#123;self.height&#125;&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">haier1 = Washer(10, 20)</span></span><br><span class="line"><span class="string">haier1.print_info()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">haier2 = Washer(30, 40)</span></span><br><span class="line"><span class="string">haier2.print_info()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">当使用print输出对象的时候，默认打印对象的内存地址。如果类定义了`__str__`方法，那么就会打印从在这个方法中 return 的数据。</span></span><br><span class="line"><span class="string">class Washer():</span></span><br><span class="line"><span class="string">    def __init__(self, width, height):</span></span><br><span class="line"><span class="string">        self.width = width</span></span><br><span class="line"><span class="string">        self.height = height</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def __str__(self):</span></span><br><span class="line"><span class="string">        return &#x27;这是海尔洗衣机的说明书&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">haier1 = Washer(10, 20)</span></span><br><span class="line"><span class="string"># 这是海尔洗衣机的说明书</span></span><br><span class="line"><span class="string">print(haier1)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">当删除对象时，python解释器也会默认调用`__del__()`方法。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">#  总结</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 面向对象重要组成部分</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 类</span></span><br><span class="line"><span class="string">    - 创建类</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  ``` python</span></span><br><span class="line"><span class="string">  class 类名():</span></span><br><span class="line"><span class="string">    代码</span></span><br><span class="line"><span class="string">  ```</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 对象</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  ``` python</span></span><br><span class="line"><span class="string">  对象名 = 类名()</span></span><br><span class="line"><span class="string">  ```</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 添加对象属性</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 类外面</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  ``` python</span></span><br><span class="line"><span class="string">  对象名.属性名 = 值</span></span><br><span class="line"><span class="string">  ```</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 类里面</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  ``` python</span></span><br><span class="line"><span class="string">  self.属性名 = 值</span></span><br><span class="line"><span class="string">  ```</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 获取对象属性</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 类外面</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  ``` python</span></span><br><span class="line"><span class="string">  对象名.属性名</span></span><br><span class="line"><span class="string">  ```</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 类里面</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  ``` python</span></span><br><span class="line"><span class="string">  self.属性名</span></span><br><span class="line"><span class="string">  ```</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 魔法方法</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - `__init__()`: 初始化</span></span><br><span class="line"><span class="string">  - `__str__()`:输出对象信息</span></span><br><span class="line"><span class="string">  - `__del__()`:删除对象时调用</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">class 类名(object):</span></span><br><span class="line"><span class="string">  代码</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 父类A</span></span><br><span class="line"><span class="string">class A(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.num = 1</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def info_print(self):</span></span><br><span class="line"><span class="string">        print(self.num)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 子类B</span></span><br><span class="line"><span class="string">class B(A):</span></span><br><span class="line"><span class="string">    pass</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">result = B()</span></span><br><span class="line"><span class="string">result.info_print()  # 1</span></span><br><span class="line"><span class="string">在Python中，所有类默认继承object类，object类是顶级类或基类；其他子类叫做派生类</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">注意：当一个类有多个父类的时候，默认使用第一个父类的同名属性和方法。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">单继承</span></span><br><span class="line"><span class="string"># 1. 师父类</span></span><br><span class="line"><span class="string">class Master(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[古法煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        </span></span><br><span class="line"><span class="string"># 2. 徒弟类</span></span><br><span class="line"><span class="string">class Prentice(Master):</span></span><br><span class="line"><span class="string">    pass</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 3. 创建对象daqiu</span></span><br><span class="line"><span class="string">daqiu = Prentice()</span></span><br><span class="line"><span class="string"># 4. 对象访问实例属性</span></span><br><span class="line"><span class="string">print(daqiu.kongfu)</span></span><br><span class="line"><span class="string"># 5. 对象调用实例方法</span></span><br><span class="line"><span class="string">daqiu.make_cake()</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string"> 多继承</span></span><br><span class="line"><span class="string">class Master(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[古法煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 创建学校类</span></span><br><span class="line"><span class="string">class School(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[黑马煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class Prentice(School, Master):</span></span><br><span class="line"><span class="string">    pass</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu = Prentice()</span></span><br><span class="line"><span class="string">print(daqiu.kongfu)</span></span><br><span class="line"><span class="string">daqiu.make_cake()</span></span><br><span class="line"><span class="string">注意：当一个类有多个父类的时候，默认使用第一个父类的同名属性和方法。</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">子类重写父类同名方法和属性</span></span><br><span class="line"><span class="string">class Master(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[古法煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class School(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[黑马煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"># 独创配方</span></span><br><span class="line"><span class="string">class Prentice(School, Master):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[独创煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu = Prentice()</span></span><br><span class="line"><span class="string">print(daqiu.kongfu)</span></span><br><span class="line"><span class="string">daqiu.make_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">print(Prentice.__mro__)</span></span><br><span class="line"><span class="string">子类和父类具有同名属性和方法，默认使用子类的同名属性和方法。</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">子类调用父类的同名方法和属性</span></span><br><span class="line"><span class="string">class Master(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[古法煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class School(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[黑马煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class Prentice(School, Master):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[独创煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        # 如果是先调用了父类的属性和方法，父类属性会覆盖子类属性，故在调用属性前，先调用自己子类的初始化</span></span><br><span class="line"><span class="string">        self.__init__()</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    # 调用父类方法，但是为保证调用到的也是父类的属性，必须在调用方法前调用父类的初始化</span></span><br><span class="line"><span class="string">    def make_master_cake(self):</span></span><br><span class="line"><span class="string">        Master.__init__(self)</span></span><br><span class="line"><span class="string">        Master.make_cake(self)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_school_cake(self):</span></span><br><span class="line"><span class="string">        School.__init__(self)</span></span><br><span class="line"><span class="string">        School.make_cake(self)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu = Prentice()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu.make_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu.make_master_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu.make_school_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu.make_cake()</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">&gt; 使用super() 可以自动查找父类。调用顺序遵循 `__mro__` 类属性的顺序。比较适合单继承使用。</span></span><br><span class="line"><span class="string">class Master(object):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[古法煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class School(Master):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[黑马煎饼果子配方]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        # 方法2.1</span></span><br><span class="line"><span class="string">        # super(School, self).__init__()</span></span><br><span class="line"><span class="string">        # super(School, self).make_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        # 方法2.2</span></span><br><span class="line"><span class="string">        super().__init__()</span></span><br><span class="line"><span class="string">        super().make_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class Prentice(School):</span></span><br><span class="line"><span class="string">    def __init__(self):</span></span><br><span class="line"><span class="string">        self.kongfu = &#x27;[独创煎饼果子技术]&#x27;</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_cake(self):</span></span><br><span class="line"><span class="string">        self.__init__()</span></span><br><span class="line"><span class="string">        print(f&#x27;运用&#123;self.kongfu&#125;制作煎饼果子&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    # 子类调用父类的同名方法和属性：把父类的同名属性和方法再次封装</span></span><br><span class="line"><span class="string">    def make_master_cake(self):</span></span><br><span class="line"><span class="string">        Master.__init__(self)</span></span><br><span class="line"><span class="string">        Master.make_cake(self)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    def make_school_cake(self):</span></span><br><span class="line"><span class="string">        School.__init__(self)</span></span><br><span class="line"><span class="string">        School.make_cake(self)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    # 一次性调用父类的同名属性和方法</span></span><br><span class="line"><span class="string">    def make_old_cake(self):</span></span><br><span class="line"><span class="string">        # 方法一：代码冗余；父类类名如果变化，这里代码需要频繁修改</span></span><br><span class="line"><span class="string">        # Master.__init__(self)</span></span><br><span class="line"><span class="string">        # Master.make_cake(self)</span></span><br><span class="line"><span class="string">        # School.__init__(self)</span></span><br><span class="line"><span class="string">        # School.make_cake(self)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        # 方法二: super()</span></span><br><span class="line"><span class="string">        # 方法2.1 super(当前类名, self).函数()</span></span><br><span class="line"><span class="string">        # super(Prentice, self).__init__()</span></span><br><span class="line"><span class="string">        # super(Prentice, self).make_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        # 方法2.2 super().函数()</span></span><br><span class="line"><span class="string">        super().__init__()</span></span><br><span class="line"><span class="string">        super().make_cake()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu = Prentice()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu.make_old_cake()</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">- 继承的特点</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 子类默认拥有父类的所有属性和方法</span></span><br><span class="line"><span class="string">  - 子类重写父类同名方法和属性</span></span><br><span class="line"><span class="string">  - 子类调用父类同名方法和属性</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- super()方法快速调用父类方法</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 私有权限</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  - 不能继承给子类的属性和方法需要添加私有权限</span></span><br><span class="line"><span class="string">  - 语法</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class 类名():</span></span><br><span class="line"><span class="string">  # 私有属性</span></span><br><span class="line"><span class="string">  __属性名 = 值</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">  # 私有方法</span></span><br><span class="line"><span class="string">  def __函数名(self):</span></span><br><span class="line"><span class="string">    代码</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">- 封装</span></span><br><span class="line"><span class="string">  - 将属性和方法书写到类的里面的操作即为封装</span></span><br><span class="line"><span class="string">  - 封装可以为属性和方法添加私有权限</span></span><br><span class="line"><span class="string">- 继承</span></span><br><span class="line"><span class="string">  - 子类默认继承父类的所有属性和方法</span></span><br><span class="line"><span class="string">  - 子类可以重写父类属性和方法</span></span><br><span class="line"><span class="string">- 多态</span></span><br><span class="line"><span class="string">  - 传入不同的对象，产生不同的结果</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&#x27;&#x27;&#x27;</span></span><br><span class="line"><span class="string">多态指的是一类事物有多种形态，（一个抽象类有多个子类，因而多态的概念依赖于继承）。</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 定义：多态是一种使用对象的方式，子类重写父类方法，调用不同子类对象的相同父类方法，可以产生不同的执行结果</span></span><br><span class="line"><span class="string">- 好处：调用灵活，有了多态，更容易编写出通用的代码，做出通用的编程，以适应需求的不断变化！</span></span><br><span class="line"><span class="string">- 实现步骤：</span></span><br><span class="line"><span class="string">  - 定义父类，并提供公共方法</span></span><br><span class="line"><span class="string">  - 定义子类，并重写父类方法</span></span><br><span class="line"><span class="string">  - 传递子类对象给调用者，可以看到不同子类执行效果不同</span></span><br><span class="line"><span class="string">class Dog(object):</span></span><br><span class="line"><span class="string">    def work(self):  # 父类提供统一的方法，哪怕是空方法</span></span><br><span class="line"><span class="string">        print(&#x27;指哪打哪...&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class ArmyDog(Dog):  # 继承Dog类</span></span><br><span class="line"><span class="string">    def work(self):  # 子类重写父类同名方法</span></span><br><span class="line"><span class="string">        print(&#x27;追击敌人...&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class DrugDog(Dog):</span></span><br><span class="line"><span class="string">    def work(self):</span></span><br><span class="line"><span class="string">        print(&#x27;追查毒品...&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">class Person(object):</span></span><br><span class="line"><span class="string">    def work_with_dog(self, dog):  # 传入不同的对象，执行不同的代码，即不同的work函数</span></span><br><span class="line"><span class="string">        dog.work()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">ad = ArmyDog()</span></span><br><span class="line"><span class="string">dd = DrugDog()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">daqiu = Person()</span></span><br><span class="line"><span class="string">daqiu.work_with_dog(ad)</span></span><br><span class="line"><span class="string">daqiu.work_with_dog(dd)</span></span><br><span class="line"><span class="string">&#x27;&#x27;&#x27;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">### 设置和访问类属性</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 类属性就是 **类对象** 所拥有的属性，它被 **该类的所有实例对象 所共有**。</span></span><br><span class="line"><span class="string">- 类属性可以使用 **类对象** 或 **实例对象** 访问。</span></span><br><span class="line"><span class="string">class Dog(object):</span></span><br><span class="line"><span class="string">    tooth = 10</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">wangcai = Dog()</span></span><br><span class="line"><span class="string">xiaohei = Dog()</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">print(Dog.tooth)  # 10</span></span><br><span class="line"><span class="string">print(wangcai.tooth)  # 10</span></span><br><span class="line"><span class="string">print(xiaohei.tooth)  # 10</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">类属性的优点</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- **记录的某项数据 始终保持一致时**，则定义类属性。</span></span><br><span class="line"><span class="string">- **实例属性** 要求 **每个对象** 为其 **单独开辟一份内存空间** 来记录数据，而 **类属性** 为全类所共有 ，**仅占用一份内存**，**更加节省内存空间**。</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">类属性只能通过类对象修改，不能通过实例对象修改，如果通过实例对象修改类属性，表示的是创建了一个实例属性。</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="comment"># 需要用装饰器`@classmethod`来标识其为类方法，对于类方法，**第一个参数必须是类对象**，一般以`cls`作为第一个参数。</span></span><br><span class="line"></span><br><span class="line"><span class="string">&#x27;&#x27;&#x27;</span></span><br><span class="line"><span class="string">### 类方法使用场景</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 当方法中 **需要使用类对象** (如访问私有类属性等)时，定义类方法</span></span><br><span class="line"><span class="string">- 类方法一般和类属性配合使用</span></span><br><span class="line"><span class="string">&#x27;&#x27;&#x27;</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">### 静态方法特点</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 需要通过装饰器`@staticmethod`来进行修饰，**静态方法既不需要传递类对象也不需要传递实例对象（形参没有self/cls）**。</span></span><br><span class="line"><span class="string">- 静态方法 也能够通过 **实例对象** 和 **类对象** 去访问。</span></span><br><span class="line"><span class="string">静态方法使用场景</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">- 当方法中 **既不需要使用实例对象**(如实例对象，实例属性)，**也不需要使用类对象** (如类属性、类方法、创建实例等)时，定义静态方法</span></span><br><span class="line"><span class="string">- **取消不需要的参数传递**，有利于 **减少不必要的内存占用和性能消耗**</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">class Dog(object):</span></span><br><span class="line"><span class="string">    @staticmethod</span></span><br><span class="line"><span class="string">    def info_print():</span></span><br><span class="line"><span class="string">        print(&#x27;这是一个狗类，用于创建狗实例....&#x27;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">wangcai = Dog()</span></span><br><span class="line"><span class="string"># 静态方法既可以使用对象访问又可以使用类访问</span></span><br><span class="line"><span class="string">wangcai.info_print()</span></span><br><span class="line"><span class="string">Dog.info_print()</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">- 面向对象三大特性</span></span><br><span class="line"><span class="string">  - 封装</span></span><br><span class="line"><span class="string">  - 继承</span></span><br><span class="line"><span class="string">  - 多态</span></span><br><span class="line"><span class="string">- 类属性</span></span><br><span class="line"><span class="string">  - 归属于类对象的属性，所有对象共有的属性</span></span><br><span class="line"><span class="string">- 实例属性</span></span><br><span class="line"><span class="string">- 类方法</span></span><br><span class="line"><span class="string">@classmethod</span></span><br><span class="line"><span class="string">def xx():</span></span><br><span class="line"><span class="string">  代码</span></span><br><span class="line"><span class="string">  </span></span><br><span class="line"><span class="string">静态方法</span></span><br><span class="line"><span class="string">@staticmethod</span></span><br><span class="line"><span class="string">def xx():</span></span><br><span class="line"><span class="string">  代码</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p><img src="http://www.zhouyi.cc/uploads/allimg/151211/4-15121114503Q54.png"></p>

    </div>
</article>


                </div>
                <aside class="col-md-4 gal-left" id="sidebar">
    <!-- 此为sidebar的搜索框, 非搜索结果页面 -->
<aside id="sidebar-search">
    <div class="search hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <form class="form-inline clearfix" id="search-form" method="get"
              action="/search/index.html">
            <input type="text" name="s" class="form-control" id="searchInput" placeholder="搜索文章~" autocomplete="off">
            <button class="btn btn-danger btn-gal" type="submit">
                <i class="fa fa-search"></i>
            </button>
        </form>
    </div>
</aside>
    <aside id="sidebar-author">
    <div class="panel panel-gal" data-aos="flip-right" data-aos-duration="3000">
        <div class="panel-heading" style="text-align: center">
            <i class="fa fa-quote-left"></i>
            esy
            <i class="fa fa-quote-right"></i>
        </div>
        <div class="author-panel text-center">
            <img src="/imgs/avatar.jpg" width="140" height="140"
                 alt="个人头像" class="author-image">
            <p class="author-description"><p>esy</p>
</p>
        </div>
    </div>
</aside>
    
    <aside id="sidebar-recent_comments">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-comments"></i>
            最新评论
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush"></ul>
    </div>
</aside>
    
    <!-- 要配置好leancloud才能开启此小工具 -->
    
    
    <aside id="sidebar-recent_posts">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-refresh"></i>
            近期文章
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush">
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/11/05/python%20work/%E6%9C%80%E5%B0%8F%E4%BA%8C%E4%B9%98%E6%B3%95/">最小二乘法</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/11/05/python%20work/%E7%BB%9F%E8%AE%A1%E5%AD%A6%E4%B9%A0-%E7%AC%AC%E4%B8%80%E7%AB%A0/">统计学习--第一章</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/11/04/python%20work/hello-world/">Hello World</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/11/03/python%20work/%E5%88%86%E7%B1%BB%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%AF%84%E4%BC%B0%E6%8C%87%E6%A0%87/">分类模型的评估指标</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/10/21/python%20work/10-21-%E7%88%AC%E8%99%AB%E5%9F%BA%E7%A1%80/">10-21 爬虫基础</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/09/25/python%20work/CRF%E7%9A%84%E6%95%B4%E4%BD%93%E6%B5%81%E7%A8%8B%E7%BB%93%E6%9E%9C/">CRF的整体流程结果</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/09/25/python%20work/nlp-crf%E6%A8%A1%E5%9E%8B/">nlp_crf模型</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/09/25/python%20work/%E6%95%B0%E5%AD%A6%E5%BB%BA%E6%A8%A1%E9%97%AE%E9%A2%983/">数学建模问题3</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/09/25/python%20work/%E6%95%B0%E5%AD%A6%E5%BB%BA%E6%A8%A1%E9%97%AE%E9%A2%982/">数学建模问题2</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/09/25/python%20work/%E6%95%B0%E5%AD%A6%E5%BB%BA%E6%A8%A1%E9%97%AE%E9%A2%981/">数学建模问题1</a>
                </span>
            </li>
            
        </ul>
    </div>
</aside>
    
    
    <aside id="sidebar-rand_posts">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-refresh"></i>
            随机文章
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush">
            
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/19/python%20work/Q-A-chatbot-%E7%AE%80%E5%8D%95%E5%AE%9E%E7%8E%B0/">Q&amp;A chatbot 简单实现</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/05/18/python%20work/VF%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/">VF基础知识</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/22/python%20work/chatbot-sorry%E7%AF%87/">chatbot_sorry篇</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/11/24/python%20work/pyhon%E5%9F%BA%E7%A1%80-%E6%A8%A1%E5%9D%97/">pyhon基础--模块</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/05/25/python%20work/python%E2%80%94%E2%80%94%E5%85%A5%E9%97%A8%E5%A4%8D%E4%B9%A0%E6%95%B0%E6%8D%AE%E5%BA%8F%E5%88%97/">python——入门复习数据序列</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/02/08/python%20work/python%E2%80%94%E2%80%94%E6%BB%91%E5%8A%A8%E5%88%87%E7%89%87%E4%B9%8B%E6%95%B0%E7%BB%84/">python——滑动切片之数组</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/12/08/python%20work/python%E5%9F%BA%E7%A1%80%E4%B9%8B%E5%88%97%E8%A1%A8/">LV-2</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/08/19/python%20work/%E5%A4%84%E7%90%86%E5%B9%B6%E7%BB%9F%E8%AE%A1%E4%B8%A4%E4%B8%AA%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%AD%E7%9A%84%E7%9D%A1%E7%9C%A0%E6%A0%87%E7%AD%BE/">处理并统计两个数据库中的睡眠标签</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/09/25/python%20work/%E6%95%B0%E5%AD%A6%E5%BB%BA%E6%A8%A1%E9%97%AE%E9%A2%981/">数学建模问题1</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/05/28/python%20work/%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E7%89%88%E5%AD%A6%E5%91%98%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/">面向对象版学员管理系统</a>
                </span>
            </li>
            
        </ul>
    </div>
</aside>
    
    
    <aside id="gal-sets">
        <div class="panel panel-gal hidden-xs" data-aos="fade-up" data-aos-duration="2000">
            <ul class="nav nav-pills pills-gal">

                
                <li>
                    <a href="/2020/05/26/python%20work/python-%E5%85%A5%E9%97%A8%E5%A4%8D%E4%B9%A0%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1/index.html#sidebar-tags" data-toggle="tab" id="tags-tab">热门标签</a>
                </li>
                
                
                <li>
                    <a href="/2020/05/26/python%20work/python-%E5%85%A5%E9%97%A8%E5%A4%8D%E4%B9%A0%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1/index.html#sidebar-friend-links" data-toggle="tab" id="friend-links-tab">友情链接</a>
                </li>
                
                
                <li>
                    <a href="/2020/05/26/python%20work/python-%E5%85%A5%E9%97%A8%E5%A4%8D%E4%B9%A0%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1/index.html#sidebar-links" data-toggle="tab" id="links-tab">个人链接</a>
                </li>
                
            </ul>
            <div class="tab-content">
                
                <div class="cloud-tags tab-pane nav bs-sidenav fade" id="sidebar-tags">
    
    <a href="/tags/py-study/" style="font-size: 14.435563192128534px;" class="tag-cloud-link">py_study</a>
    
    <a href="/tags/nlp/" style="font-size: 15.625084432901954px;" class="tag-cloud-link">nlp</a>
    
    <a href="/tags/Graduation-work/" style="font-size: 9.985259542617149px;" class="tag-cloud-link">Graduation work</a>
    
    <a href="/tags/work/" style="font-size: 13.606400486557948px;" class="tag-cloud-link">work</a>
    
    <a href="/tags/hexo/" style="font-size: 19.775668123534242px;" class="tag-cloud-link">hexo</a>
    
    <a href="/tags/%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" style="font-size: 16.911659047156608px;" class="tag-cloud-link">-个人博客搭建</a>
    
    <a href="/tags/malab-%E6%AF%95%E4%B8%9A/" style="font-size: 8.26292550949322px;" class="tag-cloud-link">-malab -毕业</a>
    
    <a href="/tags/python-%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/" style="font-size: 19.678864851363155px;" class="tag-cloud-link">-python -人工智能</a>
    
    <a href="/tags/python/" style="font-size: 17.384367282820737px;" class="tag-cloud-link">python</a>
    
    <a href="/tags/python/" style="font-size: 17.814165415026444px;" class="tag-cloud-link">-python</a>
    
    <a href="/tags/mathematical-modeling/" style="font-size: 19.399718640536857px;" class="tag-cloud-link">mathematical modeling</a>
    
    <a href="/tags/statistical-learning/" style="font-size: 12.704430495584651px;" class="tag-cloud-link">statistical learning</a>
    
</div>
                
                
                <div class="friend-links tab-pane nav bs-sidenav fade" id="sidebar-friend-links">
    
    <li>
        <a href="http://kdays.net/days/" target="_blank">KDays Forum</a>
    </li>
    
    <li>
        <a href="http://www.gal123.com/" target="_blank">绅士导航♂</a>
    </li>
    
    <li>
        <a href="http://www.moe123.com/" target="_blank">萌导航</a>
    </li>
    
</div>
                
                
                <div class="links tab-pane nav bs-sidenav fade" id="sidebar-links">
    
    <li>
        <a href="https://github.com/ZEROKISEKI/" target="_blank">Github</a>
    </li>
    
    <li>
        <a href="https://coding.net/u/SORA1" target="_blank">Coding</a>
    </li>
    
    <li>
        <a href="https://www.zhihu.com/people/aonosora/activities" target="_blank">知乎</a>
    </li>
    
</div>
                
            </div>
        </div>
    </aside>
    
</aside>
            </div>
        </div>
    </div>
    <footer id="gal-footer">
    <div class="container">
        Copyright © 2018 esy Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>.&nbsp;Theme by <a href="https://github.com/ZEROKISEKI" target="_blank">AONOSORA</a>
    </div>
</footer>

<!-- 回到顶端 -->
<div id="gal-gotop">
    <i class="fa fa-angle-up"></i>
</div>
</body>

<script src="/js/activate-power-mode.js"></script>

<script>

    // 配置highslide
	hs.graphicsDir = '/js/highslide/graphics/'
    hs.outlineType = "rounded-white";
    hs.dimmingOpacity = 0.8;
    hs.outlineWhileAnimating = true;
    hs.showCredits = false;
    hs.captionEval = "this.thumb.alt";
    hs.numberPosition = "caption";
    hs.align = "center";
    hs.transitions = ["expand", "crossfade"];
    hs.lang.number = '共%2张图, 当前是第%1张';
    hs.addSlideshow({
      interval: 5000,
      repeat: true,
      useControls: true,
      fixedControls: "fit",
      overlayOptions: {
        opacity: 0.75,
        position: "bottom center",
        hideOnMouseOut: true
      }
    })

    // 初始化aos
    AOS.init({
      duration: 1000,
      delay: 0,
      easing: 'ease-out-back'
    });

</script>
<script>
	POWERMODE.colorful = 'true';    // make power mode colorful
	POWERMODE.shake = 'true';       // turn off shake
	// TODO 这里根据具体情况修改
	document.body.addEventListener('input', POWERMODE);
</script>
<script>
    window.slideConfig = {
      prefix: '/imgs/slide/background',
      ext: 'jpg',
      maxCount: '6'
    }
</script>

<script src="/js/hs.js"></script>
<script src="/js/blog.js"></script>



<script src="/js/oni.js"></script>




</html>